<aside class="grid6">
	<div class="reservation">
		<?php
            $cabin_arr	= array(1 => '1 Cabin', 2 => '2 Cabins', 3 => '3 Cabins', 4 => '4 Cabins', 5 => '5 Cabins', 6 => '6 Cabins', 7 => '7 Cabins', 8 => '8 Cabins', 9 => '9 Cabins', 10 => '10 Cabins');
        ?>       	
        <h4>Cruise deals of the day</h4>
        <script type="text/javascript">
		function checkSearch() {
			var cate = $('select#cate option:selected').val();
			if( cate == 0 ) {
				alert('Please select cruiser!');
				return false;
			}
			return true;
		}
		</script>
        <form class="frm_reservation" action="" id="sCruise" method="post">
            <div><label>Cruise Name:</label>
                <select name="cate" id="cate">
                <?php
                $taxonomy = 'cruise_category';
                $mycat = $wpdb->get_results("SELECT t.term_id, name, slug
                    FROM $wpdb->terms t
                    INNER JOIN $wpdb->term_taxonomy tt ON t.term_id=tt.term_id 
                    WHERE taxonomy='{$taxonomy}' AND parent=0");
                foreach( $mycat as $cate ) {
                    echo '<optgroup label="'. $cate->name .'">';
                    $mysql = $wpdb->get_results("SELECT p.ID, post_title, post_name
                        FROM $wpdb->posts p 
                        INNER JOIN $wpdb->term_relationships tr ON(p.ID = tr.object_id) 
                        INNER JOIN $wpdb->term_taxonomy tt ON(tr.term_taxonomy_id = tt.term_taxonomy_id)  
                        WHERE tt.term_id=". $cate->term_id ." AND tt.taxonomy='{$taxonomy}' AND 
                            post_type='cruise' AND post_status='publish' AND post_parent=0 ORDER BY post_title ASC;");
                    foreach( $mysql as $cruise ) {
                        echo '<option value="'. $cruise->ID .'">'. $cruise->post_title .'</option>';
                    }
                    echo '</optgroup>';
                } ?>
                </select>
            </div>  
            <div id="trigger-checkin"><label>Departure Date:</label>
                <span id="trigger-checkin">
                <input type="text" id="check-in" name="checkin" value="<?php echo ((!empty($checkin)) ? $checkin : ''); ?>" required />
                </span>
                 <script type="text/javascript">
                    Calendar.setup({ dateFormat: "%b %d, %Y", trigger: "trigger-checkin", inputField: "check-in",
                    min: 0, onSelect:function() { this.hide(); }});
                    $(document).ready(function(){
                        $("select#cate").change(function(){
                            
                            $('#package').html('');
                            $('#package').css('background', 'url("<?php echo FOLDER_IMG; ?>/loading/loading15.gif") no-repeat scroll 0 10px #fff');
                            var postData	= {
                                url: 	'reload_Package', 
                                postID:  $(this).val()
                            };
                            $.ajax({
                                type: "POST",
                                url: "<?php echo TEMPLATE_URL; ?>/actions.php",
                                data: postData,
                                cache: false,
                                dataType: 'json',
                                success: function(data){
                                    $('#package').css('background', '#fff');
                                    $('#package').html(data.optPackage);
                                    $('#sCruise').attr("action", data.formURL);
                                }
                            });
                        });
                    });
                </script>
            </div>
           <!-- <div><input type="text" id="check-in" name="checkin"></div>-->
            <div><label>Cruise Package:</label>
                 <select name="package" id="package">
                    <option value="0">Please select cruise name</option>
                 </select>
            </div>
            <div><label>Cabin:</label>
                 <select name="numCabin">
                    <?php foreach ($cabin_arr as $key => $value) : ?>
                    <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
                    <?php endforeach; ?>
                 </select>
            </div>
            <div><img src="<?php echo FOLDER_IMG; ?>/icon_check.png" alt="guarantee price">
            <?php
            $taxonomy = 'cruise_category';
            $mysql = $wpdb->get_col("SELECT count(*) AS sum 
                FROM $wpdb->posts p 
                INNER JOIN $wpdb->term_relationships tr ON(p.ID = tr.object_id) 
                INNER JOIN $wpdb->term_taxonomy tt ON(tr.term_taxonomy_id = tt.term_taxonomy_id)  
                WHERE tt.taxonomy='{$taxonomy}' AND 
                    post_type='cruise' AND post_status='publish' AND post_parent=0;");
            echo $sum = $mysql[0];
            ?>
             cruises, best price guarantee
            </div>   
            <div style="margin-top:14px;"><input type="submit" class="btn_res" value="" name="booking"></div>
            <input type="hidden" name="isSearch" value="1" />   
    	</form>
    </div>  <!-- reservation -->
    
    <div class="box"><!-- support -->
        <div class="box_title">
        	<h5>ONLINE SUPPORT</h5>
        </div>
        <div class="box_body">
        <table style="width:100%; color:#1077e2; font-weight:bold;">
            <tr>
                <td colspan="2" style="text-align:center; font-weight:bold;">Sale Excutive</td>                            
            </tr>
            <tr>
                <td>Mr.Danh</td>
                <td>Ms.Hang</td>                          
            </tr>
            <tr>
                <td><a href="#"><img src="<?php echo FOLDER_IMG; ?>/yahoo.png" alt="yahoo"></a></td>
                <td><a href="#"><img src="<?php echo FOLDER_IMG; ?>/yahoo.png" alt="yahoo"></a></td>                          
            </tr>
            <tr>
                <td><a href="#"><img src="<?php echo FOLDER_IMG; ?>/icon_skype.png" alt="skype"></a></td>
                <td><a href="#"><img src="<?php echo FOLDER_IMG; ?>/icon_skype.png" alt="skype"></a></td>                          
            </tr>
            <tr>
                <td colspan="2">8:30 - 17:00 (GMT +7)</td>                          
            </tr>
        </table>
        </div>
    </div><!-- support -->
    
    <div class="box"><!-- wwhy -->
        <div class="box_title">
            <h5>WHY BOOK WITH US</h5>
        </div>
        <div class="box_body">
        <ul class="reason">
            <li><a href="#">Trustworthy travel agency</a></li>
            <li><a href="#">Prompt response</a></li>
            <li><a href="#">We are local</a></li>
            <li><a href="#">Ease of Planning</a></li>
            <li><a href="#">Customer Satisfaction</a></li>
        </ul>
        </div>
    </div><!-- why -->
    
    <div class="box"><!-- 5 step -->
        <div class="box_title">
            <h5>5 steps to book</h5>
        </div>
        <div class="box_body">
            <img src="<?php echo FOLDER_IMG; ?>/5step.png" alt="5 steps to book" style="margin-top:10px;">
        </div>
    </div><!-- 5 step -->
    
    <?php 
	global $table_prefix, $layout; 
		$groupid = 2;
		$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid=". $groupid);
		if( $mysql ) { ?>
		<div class="box2"><!-- partner -->
			<h5>partner</h5>
			<?php foreach( $mysql as $adv ) {
					?><img src="<?php echo $adv->source; ?>" alt="" style="width:230px; height:87px;" /><?php
				} ?>
			<!--<img src="<?php echo FOLDER_IMG; ?>/signature.jpg" alt="signature halong cruise" style="margin-top:10px;">
			<img src="<?php echo FOLDER_IMG; ?>/paloma.jpg" alt="paloma cruise">-->
		</div><!-- partner -->
		<?php
		}
	?> 
	<?php 
	global $table_prefix, $layout; 
		$groupid = 3;
		$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid=". $groupid);
		if( $mysql ) { ?>
		<div class="grid18">
            <div class="slider-image theme-default">
                <h5>gallery</h5>
                    <div id="slider1" class="box2"><!-- gallery -->
                        <?php foreach( $mysql as $adv ) {
                                ?><img src="<?php echo HOME_URL ?>/timthumb.php?src=<?php echo $adv->source; ?>&amp;w=230&amp;h=146&amp;q=100" alt="" /><?php
                            } ?>
                        <!--<img src="<?php echo FOLDER_IMG; ?>/gallery.jpg" alt="gallery" style="margin-top:10px;">-->
                    </div><!-- gallery -->
            </div>
        </div>
        <script type="text/javascript">
        $(window).load(function() {
            $('#slider1').nivoSlider();
        });
        </script>
		<?php
        }
	?>    
	<?php 
	global $table_prefix, $layout; 
		$groupid = 4;
		$mysql = $wpdb->get_results("SELECT * FROM {$table_prefix}banner WHERE groupid=". $groupid);
		if( $mysql ) { ?>
		<div class="box"><!-- wwhy -->
			<div class="box_title">
				<h5>links</h5>
			</div>
			<div class="box_body">
				<ul class="reason">
					<?php foreach( $mysql as $adv ) {
						?><li><a href="<?php echo $adv->url; ?>" target="_blank"><?php echo $adv->url; ?></a></li><?php
					} ?>
					<!--<li><a href="http://www.tnktravelvietnam.com/" target="_blank">tnktravelvietnam.com</a></li>
				<li><a href="http://www.mekongcruisenow.com/" target="_blank">mekongcruisenow.com</a></li>
				<li><a href="http://signaturehalongcruise.com/" target="_blank">signaturehalongcruise.com</a></li>
				<li><a href="http://www.tnkvoyagesvietnam.com/" target="_blank">tnkvoyagesvietnam.com</a></li>
				<li><a href="http://www.vietnamtailormadetours.com/" target="_blank">vietnamtailormadetours</a></li>-->
				</ul>
		  </div>
	   </div><!-- why -->
		<?php
        }
	?>                
</aside>